﻿using System;
using System.Collections.Generic;

using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using MinhTam.DataAccess.Web;

public partial class albumanhchitiet : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            InitList();
        }
    }
  
    private void InitList()
    {
        try
        {

            string albumid = Request.QueryString["albumid"];
            if (!HelpConstEnum.FIX_ALBUM.Contains(albumid))
            {
                string sql = @"SELECT aa.TEN_ALBUM,aa.MO_TA FROM ALBUM_ANH aa WHERE aa.ALBUM_ID =" + albumid;
                DataTable dt = SQLConnectWeb.GetTable(sql);
                if (dt != null && dt.Rows.Count > 0)
                {
                    lblTenAlbum.Text = dt.Rows[0]["TEN_ALBUM"].ToString();
                    mota.InnerHtml = dt.Rows[0]["MO_TA"].ToString();
                    string sql1 = string.Format(@"SELECT '{0}'+ ha.URL_IMAGE URL_IMAGE,ha.ID,ha.Album_ID
                            FROM HINH_ANH ha where Album_ID={1}", HelpConstEnum.UPLOAD_IMAGE_FOLDER.Replace("~/", ""), albumid);
                    DataTable dtImg = SQLConnectWeb.GetTable(sql1);
                    listImage.DataSource = dtImg;
                    listImage.DataBind();
                }else
                    Response.Redirect("albumanh.aspx");

            }
            else
            {
                Response.Redirect("albumanh.aspx");

            }
          
        }
        catch
        {
        }
    }

}